import { useContext } from 'react';
import { ToastContext } from './ToastProvider';
import { ToastInstance } from './types';

export const useToast = (): ToastInstance => {
    const context = useContext(ToastContext);
    if (!context) {
        throw new Error('useToast must be used within a ToastProvider');
    }
    return context;
};